

<div >




<form  class="big" id="bkform" action="" method="post"  >
 {% csrf_token %}
    <div align="center">


    同步方向<select name="source_target">
        <option value="192.168.10.132_uat1.chinayie.com"> Test132 -> UAT1 </option>
        <option value="192.168.10.132_uat.chinayie.com"> Test132 -> UAT </option>
        <option value="192.168.10.129_uat.chinayie.com"> Test129 -> UAT </option>
        <option value="192.168.10.129_uat1.chinayie.com"> Test129 -> UAT1 </option>
        <option value="break_line"> ****************** </option>
        <option value="uat.chinayie.com_www.chinayie.com"> UAT -> 生产 </option>
        <option value="uat1.chinayie.com_www.chinayie.com"> UAT1 -> 生产 </option>

    </select>


    </div>
    <div id="folders"  align="center">
    <fieldset >




        <table border="1" class="table table-striped table-hover table-bordered">
               <tr>
            {% for backend in backends %}


                    {% if forloop.counter0|divisibleby:"2"  %}
                             </tr><tr>
                             <td>
                             <div class="form-check">  <input class="form-check-input" name="selected_backends" id="{{ backend.folder }}" type="checkbox" value="{{ backend.folder }}" />
                              <label class="form-check-label" for="{{ backend.folder }}">  <strong> {{ backend.folder  }} </strong>
                              </label> </div>
                        </td>
                     {% else %}
                             <td>
                             <div class="form-check">  <input class="form-check-input" name="selected_backends" id="{{ backend.folder }}" type="checkbox" value="{{ backend.folder }}" />
                              <label class="form-check-label" for="{{ backend.folder }}"> <strong> {{ backend.folder  }}  </strong>
                              </label> </div>
                             </td>
                      {% endif %}

        {% endfor %}

    </table>
    </fieldset >


   <div style="width: 100px">  <button type="submit" class="btn btn-outline-danger"  value="Deploy">部署后端</button> </div>
</div>
</form>

 </div>
</div>


 <script src="/static/polls/js/2.1.4/jquery.min.js"></script>
<script src="/static/polls/js/popper.min.js"></script>
<script src="/static/polls/js/bootstrap.min.js" ></script>


<script>

  $('#bkform').submit(function(event){

      event.preventDefault();

      $.post(
              'deploy_backend/',
              $(this).serialize(), function(response){
                  $.ajax({
                      type: "get",      //data 传送数据类型。post 传递
                      url: "/polls/progress",  // yii 控制器/方法
                      cache: false,
                      success: function (response) {
                      $('#details').html(response);
                      }
                    })

              }
      )
  })




</script>

